<?php

/**
 * TournamentCategories filter form base class.
 *
 * @package    makethetouch
 * @subpackage filter
 * @author     Sebastien Chassande-Barrioz
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseTournamentCategoriesFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'max_team'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'nb_engaged_team' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'dead_line'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'max_team'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'nb_engaged_team' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'dead_line'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('tournament_categories_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'TournamentCategories';
  }

  public function getFields()
  {
    return array(
      'tournament'      => 'Text',
      'category'        => 'Text',
      'max_team'        => 'Number',
      'nb_engaged_team' => 'Number',
      'dead_line'       => 'Date',
    );
  }
}
